#   setwd("C:/Users/Jef/Desktop/Applied Statistics")
#   setwd("D:/Mijn Documenten/applied statistics - project")
library(qcc)

  # opgave 2a
 1-pnorm(3-5^(1/2))+pnorm(-3-5^(1/2))
(1-pnorm(3-5^(1/2))+pnorm(-3-5^(1/2)))^(-1)

  # opgave 2b(i)
 pnorm(3-6^(1/2))-pnorm(-3-6^(1/2))
 pnorm(3-7^(1/2))-pnorm(-3-7^(1/2))

  # opgave 2b(ii)
(  pnorm(3-11^(1/2))-pnorm(-3-11^(1/2))  )^3
(  pnorm(3-12^(1/2))-pnorm(-3-12^(1/2))  )^3

  # opgave 2c
  # berekenen uitkomst voor n=5:
(1-pnorm(3- 5^(1/2))+pnorm(-3- 5^(1/2)))
(1-pnorm(3- 5^(1/2))+pnorm(-3- 5^(1/2)))^(-1)
  # voor n=10:
(1-pnorm(3-10^(1/2))+pnorm(-3-10^(1/2)))
2*(1-pnorm(3-10^(1/2))+pnorm(-3-10^(1/2)))^(-1)

  # opgave 2d:
1-(pnorm(3)-pnorm(-3))  
1-(pnorm(1)-pnorm(-1)) 
1- (1-(pnorm(3)-pnorm(-3))) - (1-(pnorm(1)-pnorm(-1)) )